import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx';
import UnoCSS from 'unocss/vite'
import { resolve } from 'path';

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    UnoCSS(),
    vueJsx(),
  ],
  resolve: {
    alias: {
      '@img': resolve(__dirname, 'src/assets/image'), // 图片路径别名
      '@': resolve(__dirname, 'src/') // 根路徑
    },
    extensions: ['.js', '.json', '.ts', '.tsx', '.jsx'] // 使用路径别名时想要省略的后缀名，可以自己 增减
  },

  server: {
    port: 8080,
  proxy: {
    '/api': {
      target: 'http://localhost:48080',
        // target: 'http://127.0.0.1:48080',
      // target: 'https://play.boostream.io:8888/v1',
      changeOrigin: true,
      secure:false,
      rewrite: (path) => path.replace(/^\/api/, ''),
    }
  }
}
  
})
